This probably happens because the second activity is launched into the same task you started the browser from, which means that starting your second activity returns to the already existing task with the topmost activity (activity 1) pushed to the back-stack. See here If you make your second activity being started on a different task, pressing "back" should end that task and return to the task behind, the browser To accomplish that, you could use FLAG_ACTIVITY_NEW_TASK in the intent starting activity 2, or set the activity's android:launchMode attribute to singleTop in your manifest.
This probably happens because the second activity is launched into the same task you started the browser from, which means that starting your second activity returns to the already existing task with the topmost activity (activity 1) pushed to the back-stack. See here. If you make your second activity being started on a different task, pressing "back" should end that task and return to the task behind, the browser.To accomplish that, you could use FLAG_ACTIVITY_NEW_TASK in the intent starting activity 2, or set the activity's android:launchMode attribute to singleTop in your manifest.
When you open your Intent maybe you can set it with no-history flag intent. SetFlags(Intent. FLAG_ACTIVITY_NO_HISTORY).
I added it, but it not works! – Ming Mar 17 at 11:52 can you tell me what is the sequence exactly? – papachan Mar 18 at 14:43.
I found that only Intent. FLAG_ACTIVITY_NO_HISTORY works only if the browser was not running before. If I restart Android and run my app which call browser everything work well.
But when I start browser before my app, browser will stay in history. I tried add to manifest to activity definition android:launchMode="singleTop" according the user634618. But it doesn't work.
I don't understand why singleTop should help. In documentation is also this: BlockquoteAs another example, the Android Browser application declares that the web browser activity should always open in its own task—by specifying the singleTask launch mode in the element. This means that if your application issues an intent to open the Android Browser, its activity is not placed in the same task as your application.
Instead, either a new task starts for the Browser or, if the Browser already has a task running in the background, that task is brought forward to handle the new intent. I think that this cause the problem. But how to force run browser in current task?
As explained by other users, your Activity is being created on the browser's stack. You cannot prevent the browser from opening on its own stack, but you can do the same configuration on your application. In your activity that is called by the browser, add the following in your manifest file: android:allowTaskReparenting="true" android:launchMode="singleTask" This will make your activity to be created on your application stack (instead of the browser's).
This will basically bring your application back to the front. Android:launchMode="singleTop" will not work because it prevents creating a new activity only if that activity is on top of the stack, which is not the case as the browser is the one currently at the top. Android:launchMode="singleTask" will ensure no other instances are created regardless of them being on top or not.
If you set the Intent. FLAG_ACTIVITY_NO_HISTORY with the configuration above then everything should work fine, regardless of the browser being previously open or not. In the worst case, the browser will be at the bottom of the stack and if you keep hitting back you would eventually reach the browser instead of exiting the application.
I just edited my answer. Android:launchMode="singleTask" is mandatory for it to create the Activity in your application's task. The browser will remain in the history regardless of the flag but it will indeed be moved to the bottom of the stack.
– Daniel Freitas Aug 31 at 18:39.
As explained by other users, your Activity is being created on the browser's stack. You cannot prevent the browser from opening on its own stack, but you can do the same configuration on your application. This will make your activity to be created on your application stack (instead of the browser's).
This will basically bring your application back to the front. Android:launchMode="singleTop" will not work because it prevents creating a new activity only if that activity is on top of the stack, which is not the case as the browser is the one currently at the top. Android:launchMode="singleTask" will ensure no other instances are created regardless of them being on top or not.
If you set the Intent. FLAG_ACTIVITY_NO_HISTORY with the configuration above then everything should work fine, regardless of the browser being previously open or not. In the worst case, the browser will be at the bottom of the stack and if you keep hitting back you would eventually reach the browser instead of exiting the application.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.